package com.swak.frame.ratelimit.config;

import javax.validation.constraints.Min;

import org.springframework.validation.annotation.Validated;

import com.swak.frame.dto.base.VO;

@Validated
public class LimitConfigVo extends VO {
    private static final long serialVersionUID = -8069507347050545890L;

    private String resource;

    // 限流qps
    @Min(1)
    private int qps;

    private int capacity;

    // 是否开启限流
    private boolean enable;

    public LimitConfigVo() {}

    public LimitConfigVo(String resource, int qps, int capacity) {
        this.resource = resource;
        this.qps = qps;
        this.capacity = capacity;
    }

    public LimitConfigVo(String resource, int qps) {
        this(resource, qps, qps);
    }

    public int getQps() {
        return qps;
    }

    public void setQps(int qps) {
        this.qps = qps;
    }

    public int getCapacity() {
        return capacity;
    }

    public void setCapacity(int capacity) {
        this.capacity = capacity;
    }

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public String getResource() {
        return resource;
    }

    public void setResource(String resource) {
        this.resource = resource;
    }

}
